window.onload = function () {
  clockOn();
};

const toDual = (num) =>
  num < 10 ? '0' + Number.parseInt(num) : Number.parseInt(num) % 100;

const clockOn = () => {
  const HH = document.querySelector('#HH');
  const MM = document.querySelector('#MM');
  const SS = document.querySelector('#SS');
  setInterval(() => {
    const curTime = new Date();
    HH.innerText = toDual(curTime.getHours());
    MM.innerText = toDual(curTime.getMinutes());
    SS.innerText = toDual(curTime.getSeconds());
  }, 1000);
};
